libxl: don't leak gc pointers to caller's structs; prevent double free
authorGianni Tedesco <gianni.tedesco@citrix.com>
Fri, 10 Sep 2010 17:49:00 +0000 (18:49 +0100)
committerGianni Tedesco <gianni.tedesco@citrix.com>
Fri, 10 Sep 2010 17:49:00 +0000 (18:49 +0100)
commitb050781292056a3a1b5d05ddf28a5e71d8ee408d
treeb2e2e6d4f3a0dd91d72b9d517ae57911b00853ed
parent8ec7facba387ad9daddda55949332aa8afebf2f1
libxl: don't leak gc pointers to caller's structs; prevent double free

libxl_build_device_model uses a pointer in a caller supplied data
structure to synthesize a vif-name if one is not supplied. This is bad
juju because the caller may want to free this pointer but by the time it
get's a chance the gc has already done so. Switch to using a local
variable for this pointer and avoid a double-free in the domain create
path.

Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c